﻿/* Write a program that extracts from a given text all dates that match the format DD.MM.YYYY. Display them in the standard date format for Canada. */

using System;
using System.Globalization;
using System.Threading;
using System.Text.RegularExpressions;

namespace _19.ExtractDateTime
{
    class ExtractDateTime
    {
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-CA");

            //5.10.2012 i 8.12.2013 ne izlizat umishleno, poneje formata trqbva da e XX.XX.XXXX
            string str = "5.10.2012 pfoj fpwqj 8.12.2013 09.10.2014 12.14.2010 31.10.2010";
            Regex r = new Regex(@"\d\d\.\d\d.\d\d\d\d", RegexOptions.Compiled);
            if (!r.IsMatch(str)) Console.WriteLine("No dates found.");
            else
            {
                foreach (Match m in r.Matches(str))
                {
                    Console.WriteLine("{0}", m.Groups[0].Value.ToString());
                }
            }
        }
    }
}
